package com.cyber.app_container.service;

import com.cyber.app_container.entity.User;
import com.cyber.app_container.repository.UserRepository;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Slf4j
@Service
@RequiredArgsConstructor
public class UserService {
    private final UserRepository userRepository;

    public void saveUser(User user) {
        try {
            userRepository.save(user);
        } catch (Exception e) {
            log.error(e.getMessage());
        }
    }

    public User findByUserName(String userName) {
        return userRepository.findByUserName(userName).orElse(null);
    }
}
